﻿@using Weapsy.Domain.Languages
@model Weapsy.Reporting.Sites.SiteAdminModel

<ul class="nav nav-tabs">
    <li class="active">
        <a href="#Details" data-toggle="tab">Details</a>
    </li>
    <li>
        <a href="#Appearance" data-toggle="tab">Appearance</a>
    </li>
    <li>
        <a href="#Advanced" data-toggle="tab">Advanced</a>
    </li>
</ul>

<div class="tab-content" style="margin:25px 0">
    <div id="Details" class="tab-pane active">
        <div class="form-group has-feedback">
            <label for="HomePageId" class="col-md-2 control-label">Home Page</label>
            <div class="col-md-4">
                <input id="originalHomePageId" type="hidden" value="@Model.HomePageId" />
                <select asp-for="HomePageId" asp-items="@(new SelectList(Model.Pages, "Id", "Name"))" class="form-control">
                </select>
                <i class="form-control-feedback glyphicon"></i>
            </div>
            <div class="col-md-6 help-block">
                <label id="HomePageId-error" for="HomePageId" class="text-danger" style="display:none;"></label>
            </div>
        </div>        

        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#Default" data-toggle="tab">Default</a>
            </li>
            @foreach (var siteLocalisation in Model.SiteLocalisations)
            {
                var status = siteLocalisation.LanguageStatus == LanguageStatus.Active ? "" : " *";
                <li>
                    <a href="#@siteLocalisation.LanguageName" data-toggle="tab">@siteLocalisation.LanguageName@status</a>
                </li>
            }
        </ul>

        <div class="tab-content" style="margin: 25px 0 35px;">
            <div id="Default" class="tab-pane active">
                <div class="form-group has-feedback">
                    <label for="title" class="col-md-2 control-label">Title</label>
                    <div class="col-md-4">
                        <input id="title" name="title" type="text" class="form-control validate-title" placeholder="Enter Title" value="@Model.Title">
                        <i class="form-control-feedback glyphicon"></i>
                    </div>
                    <div class="col-md-6 help-block">
                        <label id="title-error" for="title" class="text-danger" style="display: none;"></label>
                    </div>
                </div>

                <div class="form-group has-feedback">
                    <label for="metaDescription" class="col-md-2 control-label">Meta Description</label>
                    <div class="col-md-4">
                        <input id="metaDescription" name="metaDescription" type="text" class="form-control validate-meta-description" placeholder="Enter Meta Description" value="@Model.MetaDescription">
                        <i class="form-control-feedback glyphicon"></i>
                    </div>
                    <div class="col-md-6 help-block">
                        <label id="metaDescription-error" for="metaDescription" class="text-danger" style="display: none;"></label>
                    </div>
                </div>

                <div class="form-group has-feedback">
                    <label for="metaKeywords" class="col-md-2 control-label">Meta Keywords</label>
                    <div class="col-md-4">
                        <input id="metaKeywords" name="metaKeywords" type="text" class="form-control validate-meta-keywords" placeholder="Enter Meta Keywords" value="@Model.MetaKeywords">
                        <i class="form-control-feedback glyphicon"></i>
                    </div>
                    <div class="col-md-6 help-block">
                        <label id="metaKeywords-error" for="metaKeywords" class="text-danger" style="display: none;"></label>
                    </div>
                </div>
            </div>
            @for (int i = 0; i < Model.SiteLocalisations.Count; i++)
            {
                <input asp-for="SiteLocalisations[i].LanguageId" type="hidden"/>
                <div id="@Model.SiteLocalisations[i].LanguageName" class="tab-pane">
                    <div class="form-group has-feedback">
                        <label asp-for="SiteLocalisations[i].Title" class="col-md-2 control-label">Title</label>
                        <div class="col-md-4">
                            <input asp-for="SiteLocalisations[i].Title" class="form-control validate-title" placeholder="Enter Title"/>
                            <i class="form-control-feedback glyphicon"></i>
                        </div>
                        <div class="col-md-6 help-block">
                            <span asp-validation-for="SiteLocalisations[i].Title" class="text-danger"></span>
                        </div>
                    </div>

                    <div class="form-group has-feedback">
                        <label asp-for="SiteLocalisations[i].MetaDescription" class="col-md-2 control-label">Meta Description</label>
                        <div class="col-md-4">
                            <input asp-for="SiteLocalisations[i].MetaDescription" class="form-control validate-meta-description" placeholder="Enter Meta Description"/>
                            <i class="form-control-feedback glyphicon"></i>
                        </div>
                        <div class="col-md-6 help-block">
                            <span asp-validation-for="SiteLocalisations[i].MetaDescription" class="text-danger"></span>
                        </div>
                    </div>

                    <div class="form-group has-feedback">
                        <label asp-for="SiteLocalisations[i].MetaKeywords" class="col-md-2 control-label">Meta Keywords</label>
                        <div class="col-md-4">
                            <input asp-for="SiteLocalisations[i].MetaKeywords" class="form-control validate-meta-keywords" placeholder="Enter Meta Keywords"/>
                            <i class="form-control-feedback glyphicon"></i>
                        </div>
                        <div class="col-md-6 help-block">
                            <span asp-validation-for="SiteLocalisations[i].MetaKeywords" class="text-danger"></span>
                        </div>
                    </div>
                </div>
            }
        </div>
        @if (Model.SiteLocalisations.Any(x => x.LanguageStatus != LanguageStatus.Active))
        {
            <span style="font-style: italic;">* Language Not Active</span>
        }
    </div>

    <div id="Appearance" class="tab-pane">
        <div class="form-group has-feedback">
            <label for="ThemeId" class="col-md-2 control-label">Theme</label>
            <div class="col-md-4">
                <input id="originalThemeId" type="hidden" value="@Model.ThemeId" />
                <select asp-for="ThemeId" asp-items="@(new SelectList(Model.Themes, "Id", "Name"))" class="form-control"></select>
                <i class="form-control-feedback glyphicon"></i>
            </div>
            <div class="col-md-6 help-block">
                <label id="ThemeId-error" for="ThemeId" class="text-danger" style="display:none;"></label>
            </div>
        </div>  
    </div>

    <div id="Advanced" class="tab-pane">
        <div class="form-group has-feedback">
            <label for="addLanguageSlug" class="col-md-2 control-label">Add Language Slug</label>
            <div class="col-md-4 checkbox-input">
                <input asp-for="AddLanguageSlug" />
                <i class="form-control-feedback glyphicon"></i>
            </div>
            <div class="col-md-6 help-block">
                <label id="addLanguageSlug-error" for="addLanguageSlug" class="text-danger" style="display: none;"></label>
            </div>
        </div>
    </div>
</div>